﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace gpuHough.DirectX
{
    partial class Shape<VertexType>
    {
        public class Collection : Shape<VertexType>
        {
            private List<Shape<VertexType>> items = new List<Shape<VertexType>>();

            public void Add(Shape<VertexType> item)
            {
                items.Add(item);
            }

            public void Clear()
            {
                items.Clear();
                vertexBuffer = null;
            }

            public override VertexFormats GetVertexFormat()
            {
                return items.First().GetVertexFormat();
            }

            public override VertexType[] BuildShape()
            {
                return items.SelectMany(item => item.BuildShape()).ToArray();
            }
        }
    }
}
